#!/bin/bash

# 项目根目录
ROOT_DIR="$(pwd)"

# 微服务项目列表
SERVICES=("shop-product" "shop-order" "shop-cart" "shop-pay" "shop-inventory" "shop-search" "shop-gateway")

# 移除对shop-common的依赖
remove_common_dependency() {
    echo "开始移除各微服务对shop-common的依赖..."
    
    for service in "${SERVICES[@]}"; do
        POM_FILE="$ROOT_DIR/$service/pom.xml"
        if [ -f "$POM_FILE" ]; then
            # 移除shop-common依赖部分
            sed -i '' '/<!-- 公共模块 -->/,/<\/dependency>/d' "$POM_FILE"
            echo "  已移除 $service 对 shop-common 的依赖"
        fi
    done
    
    echo "移除依赖任务完成!"
}

# 执行主函数
remove_common_dependency